﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Example_aliasing_and_Arrays
{
    class BankAccount
    {
        private int accountnumber;
        private String name;
        private decimal balance;

        public BankAccount(int accountnumber, String name, decimal startingBalance)
        {
            this.accountnumber = accountnumber;
            this.name = name;
            this.balance = startingBalance;
        }

        public BankAccount(int accountnumber, String name)
        {
            this.accountnumber = accountnumber;
            this.name = name;
            this.balance = 0;
        }

        public String AsAString()
        {
            String holder;
            holder = "Acc. nr: " + this.accountnumber + " ( " + this.name +
                " ) has balance " + this.balance.ToString();
            return holder;
        }

        public void Withdraw(decimal amount)
        {
            if (this.balance > amount)
            {
                this.balance = this.balance - amount;
            }
            else
            {
                // problems: what now? 
            }
        }

        public int Accountnumber { get { return this.accountnumber; } }
        public String Name { get { return this.name; } }
        public decimal Balance { get { return this.balance; } }


    }
}
